window.onload = function() {
    getRem(375, 10)
};
window.onresize = function() {
    getRem(375, 10)
};

function getRem(pwidth, prem) {
    console.log(window.screen.width)
    var html = document.getElementsByTagName("html")[0];
    var oWidth = window.screen.width || document.body.clientWidth || document.documentElement.clientWidth;
    html.style.fontSize = oWidth / pwidth * prem + "px";
}